import { defineStore } from 'pinia';

export const useTest = defineStore('counter', {
    state: () => {
        return { count: 0 };
    },
    // 也可以这样定义
    // state: () => ({ count: 0 })
    actions: {
        increment() {
            this.count++;
        },
    },
    storeOptions: {
        openStorage: true,
        storageWay: {
            setStorageWay: (key, data) => uni.setStorageSync(key, data), // 这里将存储方法替换
            getStorageWay: (key) => uni.getStorageSync(key),
        },
        paths:['count']
    }
});
